/*
https://leetcode-cn.com/problems/sum-of-two-integers/solution/liang-zheng-shu-zhi-he-by-leetcode-solut-c1s3/
 */
public class Solution371 {
    public int getSum(int a, int b) {
        while (b!=0){
            int c=(a&b)<<1;
            a=a^b;
            b=c;
        }
        return a;
    }

    public static void main(String[] args) {
        System.out.println(new Solution371().getSum(1,2));
    }
}
